﻿using SqlSugar;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace GWB.SqlSugar
{
    public class Repository<T> : SimpleClient<T> where T : class, new()
    {
        public Repository(ISqlSugarClient context = null) : base(context)//注意这里要有默认值等于null
        {
            if (context == null)
            {
                base.Context = new SqlSugarClient(new ConnectionConfig()
                {
                    ConnectionString = "Server=106.12.108.233;User ID=root;Password=158922123a.;Database=WebSiteData;CharSet=gbk;",//连接符字串
                    DbType = DbType.MySql,
                    IsAutoCloseConnection = true,
                    InitKeyType = InitKeyType.Attribute//从特性读取主键自增信息
                });
            }
        }

    }
}
